package controller;

import dao.GameDao;
import dao.LevelDao;
import model.Game;
import model.Level;
import model.Player;
import service.GameService;
import service.PlayerService;
import util.HibernateUtil;

import java.lang.reflect.Array;
import java.util.Iterator;
import java.util.List;


/**
 * Created by VLAD on 07.07.2014.
 */
public class Main {
    public static void main(String[] args)
    {
        PlayerService playerService = new PlayerService();
        GameService gameService = new GameService();

        playerService.createLevel(500);
        playerService.createLevel(1000);
        playerService.createLevel(3000);

        Player player1 = playerService.savePlayer("Petr");
        Player player2 = playerService.savePlayer("Anna");

        Game game = gameService.creatGame();

        playerService.addGameToPlayer(player1, game);
        playerService.addGameToPlayer(player2, game);

        //player 1 makes 0
        gameService.showGame(game);
        gameService.setOtogame(game, 1, 1);
        //player 2 makes x
        gameService.showGame(game);
        gameService.setXtogame(game, 3, 3);
        //player 1 makes next 0
        gameService.showGame(game);
        gameService.setOtogame(game, 1, 2);




        HibernateUtil.close();
    }
}
